package com.ioc.business.base.controller;


import com.ioc.business.base.domain.bo.storage.area.location.StorageAreaLocationBo;
import com.ioc.business.base.service.IStorageAreaLocationService;
import com.ioc.business.base.vo.storage.area.location.StorageAreaLocationItemVo;
import com.ioc.common.core.controller.BaseController;
import com.ioc.common.core.domain.AjaxResult;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 库区库位设置表 前端控制器
 * </p>
 *
 * @author WeiZhongRong
 * @since 2025-01-09
 */
@RestController
@RequestMapping("/storage-area-location")
@AllArgsConstructor
public class StorageAreaLocationController extends BaseController {
    private final IStorageAreaLocationService storageAreaLocationService;

    /**
     * 查询库区和库位设置列表
     *
     * @return
     * @folder 库区和库位设置/查询库区和库位设置列表
     */
    @GetMapping("/list")
    public AjaxResult getStorageAreaLocationList() {
        List<StorageAreaLocationItemVo> storageAreaLocationList = storageAreaLocationService.getStorageAreaLocationList();
        return success(storageAreaLocationList);
    }

    /**
     * 编辑库区和库位设置
     *
     * @return
     * @folder 库区和库位设置/编辑库区和库位设置
     */
    @PostMapping("/edit")
    public AjaxResult editStorageAreaLocation(@RequestBody @Validated List<StorageAreaLocationBo> boList) {
        return success(storageAreaLocationService.editStorageAreaLocation(boList));
    }

}
